

db.stu.insertMany([{
  username:"张三",
  password:"123456",
  age:23,
  city:"上海"
},{
  username:"李四",
  password:"654321",
  age:19,
  city:"杭州"
},{
  username:"王二",
  password:"abcdefg",
  age:30,
  city:"北京"
},{
  username:"小王",
  password:"243567",
  age:25,
  city:"杭州"
},{
  username:"王五",
  password:"123456",
  age:21,
  city:"北京"
},{
  username:"钱六",
  password:"asdfdghj",
  age:27,
  city:"上海"
}])



// db.stu.updateMany({username:"张三"}, { $set: {age: 32} })
// db.stu.updateMany({city:"上海"}, { $inc: {age: 2} })
// db.stu.updateOne({city:"上海"}, { $inc: {age: 2} })



// db.stu.find()
// db.stu.find({username:"张三"})
// db.stu.find({username:"张三"},{username:1})

// db.stu.find({city:"杭州",age:24},{username:1})

// db.stu.find( { $or : [ {city:"杭州"}, {city:"北京"} ] } , {_id:0})

// db.stu.find({username:/王/})
// db.stu.find({username:/^王/})

// db.stu.find({ age: { $lt:30, $gt:25 } }, {_id:0})
// db.stu.find({ age: { $lte:30, $gt:25 } }, {_id:0})

// db.stu.find().sort({age:1})

// db.stu.find().limit(2)
// db.stu.find().limit(2).skip(2*0)   0
// db.stu.find().limit(2).skip(2*1)   1
// db.stu.find().limit(2).skip(2*2)   2
// db.stu.find().limit(2).skip(2*3)   3

